Refactored/cleaned the code. Added some constraining framework. Pushing for testing.