Move messages js to js file