a whole lot of refactoring, it is all prettier now