Put success = FALSE; where it belongs, add some missing ones, remove some useless ones.