Fixed code from Nick's suggestion