Add debug, and change most plan() function to int to allow more return status - currently not implemented in sbpl