Added foregrounding/backgrounding code to Makerules file. Added code to header files fix compilation errors.