moved struct declarations to the top