updated attach func, added render func