contains partial code.& need improvement