Clean and commented FINAL code