Refactoring for 50 line limit.