Code used for research