refactoring code, removing unused fields