Refactored to make more human readable