V2

I'll put type declarations in separate unit.