refactor a common base for rective and render