added a character factory
deleted the reference to somthing in state machine in favour of using the return argument from the factory as the reference, this fixes so many headaces, and it was a weird ref anyways