Remove unused codes & make it work on python3