Updated code from fork. REOL-12