Spec stabilization, code cleaning