Fully functional version for BOW comparison