Added logging functionality; already makes debugging easier.  Bugfixes for need profile