Simplified code, added tab binding with pages