Add comments and clean up unused vars