Deleted most of the old code and started fresh based on explicit method documented in writeup