now works if logging level is not specified
Now much neater code