refactored proof