Fixed all bugs in menus and added ability to deal with keys and exits of different type.