Added if clauses appropriate for cloud.