Commented some unused code and fixed the add_invoice function