adding validate logic