alot of refactoring