I didn't give the code a thorough look-over, but...



It compiled fine for me, with no warnings or errors.



It already does this. Did you write this code yourself?