alot of new stuff and refactoring