completed rewrite - but not tested yet
completed rewrite - but not yet tested