refactor to make it better