Remove foundry dependency and refactor tests