updated, mostly all functional