Basic security refactor and ranking update refactor