Modularise codes

-Allow user to choose another template
-Modularise some parts of the codes
-Remove the whitespaces in the textarea