Completely refactored common modules for more flexibility