initial implementation of mai functionality