improved logging and output