Refactor generic system