made LOGD optional and added more helpful comments