first version, works (to change: final variable names)