Improved error reporting, added the ability to change the type of spacing used, added unit tests