Made some significant changes in the layout.
Fixed the randomization function to work properly.