added speed, moved input processing out of gui