Bug fixes and linting (unfinished on server)