Added all functions for part 1.