fixed templates and better login