code from websystems class