Only echo $out if we have something in it
Allow case insensitive button names to perform action bar actions.
Also remove some debugging console.log code
Move action bar code into a try/catch block