Fixed resolved flag on code brick

Now represents whether brick is just a reference or whether it's been
resolved
BrickTypes support nested properties.

Refactored some direct access property access, still more to go
Fixed bug to remove state and methods from brick when serializing

Need tests!