Refactored, commented