refactored and added main.h