Added rendering first code and more code clean