Revert "Better detection of valid bounds"

This reverts commit aa32d28731fa6e0123c175bcc46193163eb64512.
Revert "added support for layer groups"

This reverts commit ec7e12c63040d3f62409408af77c436c86f370ae.