Moving global params  to local params

To close the issue #25. @baalexander  could you review this to check if I have missed something?