add several functionalities to mlp.py