refactoring code round 1