Major rewrite

Port to version 12, profiles, authentication