a sample code for layered architecture