Added error handling for sections and datasets not found and added neater error reporting for the same. Also improved debug function to add support for objects as well as arrays