Improved Main Template