Improved shell script to create slides