Moved density logging to own class