Refactored into more discrete modules