refactor simple code