Delete unused code.
Move JSON API code from main class to it's subclass.
Fix undefined notice when retrieving codex count.