Added code to recursively remove empty directories. And added a curl timeout.