Reduce dependencies and tidy up