changed signature of functions

Now we pass parameters by reference to avoid calling of ctors/dtors and
memory allocations