further refactoring required