functions need more revision