work copied from webapps course