Adding small test to check stacking
Hardened test for checking domain

Style fixes as well as some refactoring