added final comment as well as some warnings in the code