saves some bytes ;)

This does the same work as before but uses better matching technique.