adding final main code