New constants parser and cleaned up style.

Includes new constants parser code and some style changes.

Cheers,
Sam