Added timeout features and cleaned the code after implementing new structure in the Beta 7 branch