Code cleanup + textbox fixes