refactored, reformatted