refactoring with doubles