Improved BoundedQ implementation. Added tests.