Simplified code and removed some double evaluation.
Commented.