moved messages into ui.js, and cleaned up