Modified some code for conditional get