Added validators, fixed some bugs