CSC488S CODE OPTIMIZATION