Added comments
Restructured and added the logger