some refactoring, scales improved