added files...
polished algorithm