Adds more verbose logs. Removes unnecessary casts between long and int.