refactoring needs to be done