Finished assigment, some really hacky bits that need to be tidied up though