implmenting rendering function