TODO: Move lock analysis up the list