Implemented the working code from previous commit with changes to make it python3 compliant.