Merged Fred's changes