Consistent identation and other small code improvements
Still refactoring...