moved function out of class