Added check on keys pressed we want to track; build JSON structure