completed most functionality