Proper message loop

-now the application will always respond to client requests.