Changes contributed by @cristizmf! Thank you so much!