[custom-renderer] improve code