place common code home.js and intgerate flow accordingly