some improvements for integrating into express