Modified variable names to make more sense. Consolidated apply constraint subroutines. Removed extraneous printf statements