Improve indentation and fix a few bunch of bugs. Implement const inheritance for loops.