Code Refactored for CI