code clean up and center view