kinda work but the timing function is weird