Rewrote to remove need for extrernal file and improve functionality.