Cleaned up and clarified some points. Tried to make it clear where code from Ming-Wei was used.