Adding logging and distribution improvements