Refactor, objects instead of built in types and py3 support