big refactor to more single return values