Replaced _type with a better approach, thanks Yosy