Modified this as per mhutch's request.