enhancement: refactor to divide into sub-packages without changing interface