implemented rails-style controller