some cleaned code updated