adjusted rendering code