Cleaned up code. Placed docstring before arguments for defn, made sure
code didn't overflow 80 characters etc