minimize scope of module functions/members; add missing cimports