implement few algorithms for allocate terminals- but there could be a big mess