Refactor setpu code into category