Repaired the lost code

It needs prettying though