Update: almost working