Added validation before class file writing.