This works, but is not really elegant