A bit of refactoring and adding missing classes