changed output format
added logging functionality