added logging options and fixed things