changes to better validation (still a lot to do)