Added copy constructors and assignment operators to fix some bugs, tidied up the main file