added validtion logic