Added algorithm tex
Updated algorithm and code