modified getByType method