Started to rewrite the textbox code

Started to rewrite the textbox code to make it more ecanomic