Implementation of both functions.

I though this would take more time, but that's it.