use instancetype throughout code.  Also added a logger with a default path and auto selection of log level based on preprocess DEBUG flag
update file modes