added button listeners, changed the auto re-size and reduced the initialisation count