refactoring of old code