Added validation in js