This is optimized for a COMP550 extra credit assignment