barebones rebuild of ActiveRecord