Merged changes between mine and Junyang's.