no more errors

Everything is finally working. I had to change the code a little bit to
make sure that there wasn't any double integration going on, but the
actual logic remains the same