Abstract out functions
Fix until it passes