Adapting the code to the new API mxgame and adding exceptions.

Signed-off-by: Emerson Max <emersonmx@gmail.com>