New version. Updated a bug in the ns and better code.