removed a bug.
made some parameters of functions/constructor const