I think you should start with a simpler example like this.
Then you can address the issue of a dictionary as a parameter