Rewrote code; Its still bad.