Slight fixes to codes