Code fixes

- modified code to work with the changed structure