improving controllers and templates