add almost working implementation