There probably was a more elegant way to do this