Move server loop to run method