Initial script which is at a point of needing major refactoring.