Added some message handling and moved some classes around.