Added requirements.txt
Cleaned up code and added Python 3 compatibility