Refactor to use servlet engine