code moved and commented