improve method for retrieving settings and running command