usability improvments
refactored validation cod and fix it