finished most functionality