Reduce code duplication & add readme