wip: writing proxy (part 2)

Taking another approach, but code is getting mess. It seems that
I should reconsider the whole design.