re arrange functions