added custom invalidclass to validate function, added autoinsertion of filename