The logic in the button visibility and invisibility was incorrect. Fixed that issue.