refactored rendering function in each controller (no longer in __construct() but in index())