Added grammar and application logic