add very confusing but functional logging system.
add comments