Added comments to core code logic