improving and cleaning up a bit
adding layer/stacking related functions
adding lib2patches.m