wondering what the best way of adding a function without breaking the code

Ok.
Keep it to one thread (not this one, but this one)
Use code tags (you're a university student, dammit - what happened to simple literacy?)

Thread locked.