Tested code. Console printed out correct value.