-p option added to mkdir to avoid errors with existing directories