Moved some code into setup() instead of loop()