minor changes
Revert "Revert "rewrote loop mostly with bsxfun""

This reverts commit 2ee2b753d8ebf4e0ec3bd34b318388f8a569afe6.
added todo