Optimized Rheya with greatly reduced database transactions; fixed direction bug in get_word where next_word would become previous word and vice versa