On subalgebras of $C^*$-algebras