functional, still some bugs, fixed export problem