Rewrote some parts