Small changes. Using 'type' instead of checking path