Error fixing..
major refactoring