Added getNextCategories function. Javadoc follows soon