added straightforward (and ugly) version