Not sure how good practice in C++ it is to use local static variables as opposed to class instance ones, but I'm ok with it.