refactor some code
change some wrong names from stack to layer