Works all the way through with proper inputs