adding modules refactored out of original code