Add changed code from  @Arcovion