Clean up more global environment
generate reusable get functions on environment
Apply getBQuery