Final version 1.00

Reimplemented function await(int) and advance() with  conditions
Added function releaseMemory(...) to avoid same code