added frontend validation