Validations added, bugs fixed and some modifications.