further refactor to FP