Huge chunk of work, implemented most functionality