Move some utility methods to separate class.