Added parameter decoupling, and fixed some bugs