Refactor; message js