update main, improve timer