megodinero:
But I'm getting random freezes and restarts... =\
NodeMCU - so let me guess: you getting wdt timeout errors?
Do allow for background processes to run - specifically it's networking stack. Any long routines must have yield() calls in them. Do read up on how to program the ESP8266, and get the "ESP exception decode" add-on for the Arduino IDE so you can actually make sense of those stack traces. That's another great help in tracking down the cause of crashes.