Clean Up Template File

Refactor code into block file