SA: remove dead code, improve readability and annotations