less redundancy
Implement callback in case of javascript errors or timeouts, closes #98