start to split into extra functions