changes to make this more flexible