All the code in 3-tier format