Fixed some js issues and added the ability to specify a message along
with the error