synced mm function with environment variable