Improved indentation, better formatting

Needs more comments… Maybe later.