Imported from https://github.com/vlukiyanov/pt-dec