Fix bug in key handling
Add lazy graphics optimization