Added retry logic.

Fixes #40 
New line at the beginning of function