Tidying up the code based on PEP8 style guide