cleaning up and beginning serious work with logging in layer