Cleaned up code (pylint) and added more documentation