Using return here isn't idiomatic julia (you've inserted it a few times below)