final code, ready to be annotated