Loads of changes, refactoring, fixes...