mkdir -p functionality cleaned up