Various cleanups to messages and JS