function order messed up
fixing merge conflicts