refactor controllers and views; fix routes