added untested functions code. more work will be needed