Seems unnecessarily complicated, but okay