changing the getKeywords method to be more concise as per the comment by @arshsab