code cleaning, new handler api