Most recent working code.