Seperate the messy template to little modules

Seperate the messy template to little modules, using extends and block.