Start adding idle loop code - not finished yet