major refactoring. introducing common reusable controller, and cj readers and writers