Line spacing fixed, refactored some code to make it better for future use