changed syntax and simplify implementation