cut out some fat and refactor