Clean up and add timeout support
version 0.5