refactor to be more simple