Improved sanity checking & whitespace
Improved sanity checking
Improved sanity checking & removed debug output