refactored to be more concise