Include gaurds added.
vairious refactoring
MainEntity added as a background class.