refactored to make formula creation by factory