added keyword checking helper method to be DRY and passing tests