Also added in window focus change callback so that we can animate UI in correctly. Also other small changes