added options -d -s for debugging