works and is more vectorized now :)