changed method name and correctly implemented state variable