Merged with Isaac's changes