Edited both functions