added unit testing for next and cfg