Added InputState class
BugFix: Background context fixed