Working on modularizing the code.