Refactored factor finding to common library