Add lock switch to settings; sort tables before locking them