final version of submited code.