Updated HRL code