implemented pointers from the nice people over at /r/learnprogramming