Commenting, structuring and refactoring some.