removed if data!=null and replaced it with else statement