Added design doc and fixed minor changes