Final version with rest