Implemented keyword algorithm

TODO: Tests & validation.