Better respect to specification algorythms + JSDocs added