Some common functions for web app.