moved configuration up a function