solved problem #40