functional approach, and removed linker warning
preparing for parallelization