moved render code to one function. Keeping it simple