Created more modular code by adding a common_functions php include file. Refactored function code.