Organized some parts of the code.