Edited code to avoid pointless function when annotation is null