Implements normalize; Fixes a few random bugs