Better patch, using a function