rewrote allocating ops; added functions