Fix spacing and adding more error checking
Merge pull request #333 from timiblossom/1.2

Fix spacing and adding more error checking