Changed maia to run in a different thread