Brought over Justin's changes.