Fix extract handler, tests need to be refactored