This is tim's code. It was just moved