Fixed errors Testing code

Code used from tutsplus.com written by Sue Smith.