cleaup and minor adjustment when adding path overlay
refactoring and moving code around