Changed rendering method, added functions