Rewrote the code for validation of custom properties

This resolves issue #144