first work version, still need improvement