modified the getByType method