refactored nptype()