re-coded functions