Changed gameloop. The problem is how input is handled.