Merge "Added Unit Tests and Demo Implementation for Mainloops"