numerous design changes and create global variables