commented code and fixed validation issues