Refactoring & a test fail

Refactored and cleaned up some code
JSONfile package does not handle file-names w/ spaces in them...