updated.
improved basic structure and implemented validateRequiredFields function.