added logging, finished v1 of commandline tool