both functions implemented