Added functions to controllers and corresponding views