tidy up free in device detect functions