Fixed tmp bug, marked functions as private