fixed the bug with procedure parameters. Refactoring the source code a
bit.