modernization: seems like the generic algorithm seems to work \o/