Made rest.js more DRY.