First version of integrator - unfinished