should be working now... need to add if ! d condition at some point...