implements all functions