Can not remember what this is but seems like a lot of refactor