added comments, timeout is now calculated with variables