fixed errors on different render functions, added switch