move most declarations to header file