Improved indentation and fixed some more minor issues