First commit. Auth logic almost ok