Moved key state into struct