Refactor data method in Amazon onebox