Implemented Cache into Layer and fixed some other mistakes...