Add socket timeout/fallback. Add refresh interval options
Create main function to allow importing