Fixed issues to DRY.

Repeating lines of codes, non used variables deleted.