layers implementation for checkpoint 3