Continued refactoring
Added logging macro