slopped together some more logic