cleaned up implementations and commented