Modified to use constants form SHUT_RD and SHUT_WR