Added advanced error management and generalized cs code