Added some checks for validation to show the correct button etc