Add more unit tests and did some ugly fixes with keyword checking.