replaced the last bit of old code