refactoring some code cleanup on Monday and testing