Added comments and minor validation tweaks