update
major refactor, python3 ready