Code

A few big changes in this commit: