added logging and updated some stuff, pre logging refactor