written more efficient version of find free
removed loopy function