Clean up code.
Assign weights.