added attempts parameter to constructor