added proper validation