made error checking more comprehensive
Title to specter