Changes in Second Algorithm

Added two functions

Change-Id: Ieb16cfbf5f42e9ec8282a0bae7a72520c8f121d7
Signed-off-by: Andrey Shamis <lolnik@gmail.com>