Remove repetitive common parameters and if/else handling of flow types to improve readability - Add unit tests after refactoring