set s to the correct digits, added comments.

removed debugging code, added useful comments