fdm refactored