Many enhancements, including main loop

TBD: retrieval of data from HTTP API