Loads of little fixes, needs testing before pushing