first "working" version. more to do though.