cleaned up logging code