Moved Main and added a small loop.