refactored for 1.3 support