Edits to ending and beginning

Adding to code an debiting errors while running