Modified index to contain same code as API sample