Cleaned up code and formatted such that it fits in fixed with 80 character spaces