Added a first, rought test suite.
Fixed bug with active layer id in some functions.