fixed focus and button grabing and cleaned code