added resize terminal signal handling, added a selected item index