Added some comments + Minor refactorings