refactor and speed up advancing target