Major refactoring, this time had a chance to test it