Removed debugging statement
Wrap commands in check for filename