Refactored. Philip