moved function out (kinda dumb)