integrated stephen's changes and resolved merge conflicts