Stable version with modular functions