Use coercion
Refactored functionality into modules