added context to error messages
changed scheduling to a simple while/sleep