Added if else statements for each button. Code done by Rob and Dan.