Changed the button-validationcode so its more DRY-code and dynamic.