refactoring, less magic numbers