Merged some of Randall's code.
Merged ALL of Randall's code.