made more robust and commented my code.
2 files changed