clean up html after hidden message
Optimized javascript style