code refactor better