cleaned up, commented, refactored
cleaned up, commented, refactored