created function for rendering
lots more content and cleaned up source