changed offsets, updated and added comments.