cleaned up json parsing