create log handler
bugs fixed
unused code removed