rewrote for remote use