moving some code around and set timeout to 1 second