added delete function, changed focus handling to directive