export command finished, small code reestructurarion