close #30 #31, still working on some performance improvements