Fix broken OSK in messenger and rearranged some code