made a function slightly less stupid