timeout fix/code clean up