**please remind me to rewrite this in rust finally**