Unify logging, add debugging