bin/mypa: extract functions and make sure kmix is available