clean commented refactored