first attempt at layered problem