refactoring keyword logic into keywords