some cleanup and helpful log functions