code integrated fully with a lot of changes