moved more templates to templates and  wrote some MYSQL queries