added final comments code has been tested works!