Code that seems to work (with comments that follows Adeneo standard)