#5 Added timeout
#5 Layout optimization