Add attempt 2 - almost finished. A few bugs to fix