Added Main Loop

Main loop now trys to maintain a 1mS loop via polling.