De-bugged code for HW1