final version of all codes