Restructured code for factorial calculation
Reorganized code as per library file restructuring