Added working version of fill algorithm before tidy-up