Fixing errors after moving functions into classes and so