Added swap method to context; cleaned up web client code