Clean code, fix CSS conflicts, add JS block to templates