included factorial method and updated cycle method to work correctly"