rewriting the anealin part and main