Scaffold, JSON return and random logic