Some rendering refactor