Added the automatic checks and sample classes
Made changes by adding some error checking code