Commented most of the code