A lot of changes, I should probably have commited before this