Added Python3 compability. Fixed problems with decorator. Fixes #1