added network code & changed rotate left to clockwise