Sample source code for MAP