Fixed James' code.