Refactored code for integration with Rails app

Now uses params={} as optional named arguments instead of array