code refactor part one