refactor to cleanup readability