Merge "Tidy up module-lib API and locks"