Refactors methods to support json