converted to pythonic style
simplified and refactored code a bit
changed data types and spacing