Remake of the entire program to be more optimized