this all just got moved to a function