updated almost working model