added some front-end validation
smoother validation