Updated code from fork. REOL-25