More refactoring, pretty nice now :p