[FP] Some code reorganization