need to tidy & proove function finder