Use NSNotificaion and some other improvements