refactored alot of code for speed improvements