refactored rendertree creation