Modified code to attach together Alberto and Hao work