few code updates

I'll add comments in code