Made Drawing algorithm more efficient.