Rewrote into nicer format