refactored to make more standard format