Implements all functions.