Implements the basic functionality