applied guard and sprok for improved testing