refactoring of older code