added this. or xApp. where needed
made few things protected where needed