Refactor to support default webmachine