add the `_ace` and `_stringify` internal helper functions and use them to refactor