refactor interface.rb and add tests