mlp.py modified