make it compatible with javascript export (and also a lot slower)