refactoring, redundant code removed