Reduce memory usage

Spark API allocate too much memory by generating big inspect data for debug messages.
Removed adding debug message if there is no debug level.

Added cleanups.