everyday I'm refactoring (version confirmed to work)