Code review

I applied my points in the CR discussion, plus a few more things