refactored for real this time