Changed to only use window
Removed calls to global functions
Changed tests to use new Page
Moved splitting to class.
Tidied css creation.