Added validation to allow only loggedin users