Added support for renderers and some refactoring