after merging with michael's modifications.