refactored validation; added validation to resources
fixed whitespace
tweaked validation for resources