Revert "Remove debug output, fix some bugs and add command prompt"

This reverts commit ec3f31f1779095bbf271d9e3881c2f0fc9bd680a.