Functionalized the code.