Added some logic for showing of buttons