code refactor 2