cant remember if we use this elsewhere, might be worth moving it to ./lib