Some refactoring of namespaces. Added initial ActiveRecord implementation