Fix style bugs and add try-catch block for hasFlashLight-method