Replace 1000 with msecsPerSec
Slight improvement
Improve layout algorithm