Added support for Access-Control-Allow-Methods and tidied slightly.