Second commit

Added comments, changed variable m to i for clarity