New version with the functions implemented