Hopefully finished with refactoring to make the number of rows changeable.