first working implementation of custom validation