Improved logging. Now supports multiple logging levels.