rewised, corrected some checking methods
breaking it up into smaller pieces