Make it possible to run multiple MAS instances using masctl

And modify test runner to use masctl
Fix function declaration