Added foundation.
Add some JSON generation and fix callback design.