Better implementation of the web service, cleaned up system, now with some logging