Tidy server code & remove unused variables/imports