Not the most elegant, but somewhat generic
Too slow