Code tidy-up and updated legacy dependency