Added predicted text search
Added additional checks, comments and beatify