Mutex rewrite

Fixes mutex functionality for the extension, because I'm a huge dumb and
committed something that wasn't actually working.