Make more use of DefineConsoleMethod

Resubmission of #887 with some fixes.
Better add some docs to this monster funcion :(