modified with extra functionality and foreman compatibility