slight changes to make it work