Added a clicklistener which resulted in a lot less code and more structured