commented optimixed code