added timeout after reader activation, cleaned up code