Changed the order of the loops and simplified the speed of the pulsing