implementation almost done
needs testing