Code nearly done