finish all functions, need to test