Adjust factory method to follow Flask extension guidelines

Based on #130