support log levels, refactor cleanup