added some checks and few visual changes