Fully restructured the code. Methods created.