Moved some logic to right classes. Initiating conversion to python 3 syntax