Added most functionality. Needs updating