refactor and fix master forward