moved location stuff out of server handler