This code seems a bit verbose.