I changed it a bit, hopefully that should cover most eventualities.