Fixed not keyword and refactored keyword handling