Working version. Interlayer interaction implemented