Fixes for mainloop tests
Started adding example