Refactored for 1.51