Refactor s:type()